import { MenuListParams } from "@/types/menuTypes"
import { orderParamsType } from "@/types/orderTypes"
import request from "@/utils/request"
import qs from "qs"

// 推荐菜单
export const recommendMenu = () => {
  return request.post('/api/nest/menu/recommend')
}

// 菜单列表
export const menuList = (params: MenuListParams) => {
  return request.post('/api/nest/menu/list', qs.stringify(params))
}

// 下单
export const placeOrder = (data: any) => {
  return request.post('/api/nest/menu/placeOrder', data, {
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

// 收藏列表
export const favoriteList = (params: orderParamsType) => {
  return request.post('/api/nest/menu/favorite/list', qs.stringify(params))
}

// 收藏
export const menuFavorite = (params: { menu_id: number }) => {
  return request.post(`/api/nest/menu/favorite/${params.menu_id}`, qs.stringify(params))
}

// 取消收藏
export const cancelFavorite = (params: { menu_id: number }) => {
  return request.post(`/api/nest/menu/cancelFavorite/${params.menu_id}`, qs.stringify(params))
}

// 商品详情
export const menuDetail = (params: { id: number }) => {
  return request.post(`/api/nest/menu/detail/${params.id}`, qs.stringify(params))
}
